package com.api.shopapi.mapper;


import com.api.shopapi.entity.UserAppInfo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface UserAppInfoMapper {

    @Insert("insert into user_app_info(UserAppInfoCode,UserCode,AppOs,RegId) values " +
            "(#{userAppInfo.UserAppInfoCode},#{userAppInfo.UserCode}," +
            "#{userAppInfo.AppOs},#{userAppInfo.RegId})")
    int insert(@Param("userAppInfo") UserAppInfo userAppInfo);

    @Delete("delete from user_app_info where UserAppInfoCode=#{userAppInfoCode}")
    int delete(@Param("userAppInfoCode") String userAppInfoCode);

    @Update("update user_app_info set UserCode = #{userAppInfo.UserCode},AppOs = #{userAppInfo.AppOs}," +
            "RegId = #{userAppInfo.RegId} "+
            "where UserAppInfoCode=#{userAppInfo.UserAppInfoCode}")
    int update(@Param("userAppInfo") UserAppInfo userAppInfo);


    @Select("select * from user_app_info where UserAppInfoCode=#{userAppInfoCode} limit 1")
    UserAppInfo getByUserAppInfoCode(@Param("userAppInfoCode") String userAppInfoCode);

    @Select("select * from user_app_info where userCode=#{userCode} limit 1")
    UserAppInfo getByUserCode(@Param("userCode") String userCode);

    @Select("select * from user_app_info")
    List<UserAppInfo> getList();

}
